package ThreadDemo;

public class TreadDemo20 {
//    static class count{
//        int count=0;
//        void add(){
//            count++;
//        }
//    }
    static int count=0;
    public static void main(String[] args) throws InterruptedException {
        Thread thread1=new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    count++;
                }
            }
        });
        Thread thread2=new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    count++;
                }
            }
        });
        thread1.start();
        thread2.start();
        thread1.join();;
        thread2.join();
        System.out.println(count);
    }
}
